using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using System.Data;
using XBLib.Dal.AdoDal;
using DataInfo;
using KenLib.Common;
namespace KenLib.Dal
{
    public class 通勤情報Dao : BaseAdoDao
      {
          private string m_requestTime;
          private string m_displayTime;
          public int Insert(通勤情報 obj)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                  DbParameter param1 = _daoHelper.CreateParameter("@通勤コード", obj.通勤コード, DbType.String);
                  DbParameter param2 = _daoHelper.CreateParameter("@交通手段名", obj.交通手段名, DbType.String);
                  DbParameter param3 = _daoHelper.CreateParameter("@開始区間", obj.開始区間, DbType.String);
                  DbParameter param4 = _daoHelper.CreateParameter("@終了区間", obj.終了区間, DbType.String);
                  DbParameter param5 = _daoHelper.CreateParameter("@交通機関名称", obj.交通機関名称, DbType.String);
                  DbParameter param6 = _daoHelper.CreateParameter("@経路着駅", obj.経路着駅, DbType.Int32);
                  DbParameter param7 = _daoHelper.CreateParameter("@経路発駅", obj.経路発駅, DbType.Int32);
                  DbParameter param8 = _daoHelper.CreateParameter("@経路経由駅", obj.経路経由駅, DbType.Int32);
                  DbParameter param9 = _daoHelper.CreateParameter("@交通費対象期間月数", obj.交通費対象期間月数, DbType.Int32);
                  DbParameter param10 = _daoHelper.CreateParameter("@有効開始年月日", obj.有効開始年月日, DbType.DateTime);
                  DbParameter param11 = _daoHelper.CreateParameter("@有効終了年月日", obj.有効終了年月日, DbType.DateTime);
                  DbParameter param12 = _daoHelper.CreateParameter("@通勤交通費", obj.通勤交通費, DbType.Int32);
                  DbParameter param13 = _daoHelper.CreateParameter("@マイカー通勤キロ数", obj.マイカー通勤キロ数, DbType.Int32);
                  DbParameter param14 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Insert_HumanCommutingInfo, CommandType.StoredProcedure,param20, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "INSERT", "Insert_HumanCommutingInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

          public int Update(通勤情報 obj)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                  DbParameter param0 = _daoHelper.CreateParameter("@ID", obj.ID, DbType.Int32);
                  DbParameter param1 = _daoHelper.CreateParameter("@通勤コード", obj.通勤コード, DbType.String);
                  DbParameter param2 = _daoHelper.CreateParameter("@交通手段名", obj.交通手段名, DbType.String);
                  DbParameter param3 = _daoHelper.CreateParameter("@開始区間", obj.開始区間, DbType.String);
                  DbParameter param4 = _daoHelper.CreateParameter("@終了区間", obj.終了区間, DbType.String);
                  DbParameter param5 = _daoHelper.CreateParameter("@交通機関名称", obj.交通機関名称, DbType.String);
                  DbParameter param6 = _daoHelper.CreateParameter("@経路着駅", obj.経路着駅, DbType.Int32);
                  DbParameter param7 = _daoHelper.CreateParameter("@経路発駅", obj.経路発駅, DbType.Int32);
                  DbParameter param8 = _daoHelper.CreateParameter("@経路経由駅", obj.経路経由駅, DbType.Int32);
                  DbParameter param9 = _daoHelper.CreateParameter("@交通費対象期間月数", obj.交通費対象期間月数, DbType.Int32);
                  DbParameter param10 = _daoHelper.CreateParameter("@有効開始年月日", obj.有効開始年月日, DbType.DateTime);
                  DbParameter param11 = _daoHelper.CreateParameter("@有効終了年月日", obj.有効終了年月日, DbType.DateTime);
                  DbParameter param12 = _daoHelper.CreateParameter("@通勤交通費", obj.通勤交通費, DbType.Int32);
                  DbParameter param13 = _daoHelper.CreateParameter("@マイカー通勤キロ数", obj.マイカー通勤キロ数, DbType.Int32);
                  DbParameter param14 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Update_HumanCommutingInfo, CommandType.StoredProcedure,param20, param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "UPDATE", "Update_HumanCommutingInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

          public int Delete(int id)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param0 = _daoHelper.CreateParameter("@ID", id, DbType.Int32);

                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Delete_HumanCommutingInfo, CommandType.StoredProcedure, param0);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "DELETE", "Delete_HumanCommutingInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }
      }
}
